﻿using MyApp.IRepository;
using MyApp.IService;
using System;
using System.Data;

namespace MyApp.Service
{
    public class BaseService<TEntity> : IBaseService<TEntity> where TEntity : class, new()
    {
        protected IBaseRepository<TEntity> _baseRepository;
       
        public int Delete(TEntity entity)
        {
            return _baseRepository.Delete(entity);
        }

        public int Insert(TEntity entity)
        {
            return _baseRepository.Insert(entity);
        }

        public int Update(TEntity entity)
        {
            return _baseRepository.Update(entity);
        }

        public int ExecuteCommand(string sql)
        {
            return _baseRepository.ExecuteCommand(sql);
        }

        public DataTable GetDataTable(string sql)
        {
            return _baseRepository.GetDataTable(sql);
        }

        public TEntity QuerySingleByPK(string PK)
        {
            return _baseRepository.QuerySingleByPK(PK);
        }
    }
}
